//
//  SEFocusModel.m
//  kuaiyi
//
//  Created by LQC on 16/7/7.
//  Copyright © 2016年 Alphts. All rights reserved.
//

#import "SEFocusModel.h"

@implementation SEFocusModel

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

+(instancetype)modelWithDictionary:(NSDictionary *)dict{
    
    SEFocusModel *model = [[SEFocusModel alloc]init];
    
    [model setValuesForKeysWithDictionary:dict];
    
    return model;
}
//flower = 0;
//operation_count = 0;
//banner = 0;
//doctor_hospital_name = 北京协和医院;
//doctor_name = 何晔鑫;
//doctor_portrait = http:// hdkj-web1.chinacloudapp.cn:8080/res/2093000003151445677716555.jpg;
//doctor_title_name = 心理医生;
//accuracy = 98%;

+(void)focusListWithSuccess:(void (^)(NSArray<SEFocusModel *> *focusList))successBlk error:(void (^)())errorBlk{
    
    NSString *urlString = kMatchDoctors;
    NSDictionary *paramDic = @{@"ci1_id":@1,
                               @"ci2_id":@3,
                               @"ci3_id":@3,
                               @"diagnosis_type":@0,
                               @"page_size":@15,
                               @"is_confirmed":@1,
                               @"user_id":@1000089,
                               @"page":@1,
                               @"has_diagnosis":@2
                               };
    
    
   
    
    [[NetworkTool shareManager] POST:urlString parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary *  _Nullable responseObject) {
        
        NSMutableArray *mArray = [NSMutableArray array];
        
        NSArray *tempArr = responseObject[@"data"];
        
        [tempArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            
            SEFocusModel *model = [SEFocusModel modelWithDictionary:obj];
            
            [mArray addObject:model];

        }];

        if (successBlk) {
            successBlk(mArray.copy);
        }

    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
        if (errorBlk) {
            errorBlk();
        }
    }];

}


+ (void)focusListWithPVDAndSuccess:(void(^)(NSArray<SEFocusModel *> *focusList))successBlk{
    
    
    [self focusListWithSuccess:successBlk error:^{
        
        [SVProgressHUD showErrorWithStatus:@"网络超时"];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            [SVProgressHUD dismiss];
        });
        
    }];
    
}




@end
